# 变量
import time

x = 10
name = '三丰'
print(x, name)

# 运算
a = 7
b = 2
print(a % b)
print(a ** b)
print(a // b)

# 判断
# 0晴天  1阴天  2下雨
# weather = 1
# if weather == 0:
#     print('晴天')
# elif weather == 1:
#     print('阴天')
# else:
#     print('下雨')

# weather = int(input('请输入0/1/2来获得天气预报：'))
# if weather == 0:
#     print('晴天')
# elif weather == 1:
#     print('阴天')
# else:
#     print('下雨')

# 循环
# 未来在清洗数据的时候，可以帮我们批量整理数据格式
# for i in range(10):
#     print(i)

# count = 0
# while count < 10:
#     print(count)
#     count += 1

# 用户输入+if交互
# n = 8
# guess = int(input('你猜数字是几？'))
# if guess == n:
#     print('猜对了')
# else:
#     print('猜错了')

# 用户输入+while交互
# n = 8
# while True:
#     guess = int(input('你猜数字是几？'))
#     if guess == n:
#         print('猜对了')
#         break
#     else:
#         print('猜错了')


# 列表
# stars = ['张三丰', 'ikun', 'TFbodys', 'Kobe']
# # print(stars[1])
# for star in stars:
#     print('idol名字:', star, '排行第', stars.index(star))

# 元组
# stars = ('张三丰', 'ikun', 'TFbodys', 'Kobe')
# # print(stars[1])
# for star in stars:
#     print('idol名字:', star, '排行第', stars.index(star))


# 字典  键值对   某个事物具备多个信息需要表达
ikun = {'name': '坤坤', 'score': 100, 'skill': '唱跳rap篮球'}
print(ikun['skill'])


# 函数
# 一堆逻辑集合（取钱、存钱、开户）
# def add(c, d):
#     print(c + d)
# add(1, 2)

# print输出方式
# 连接符
print(2024, '08', 27, sep='-')

# 结束符
print("hello", end=',')
print('world')

# 普通方式输出
print('姓名:',ikun['name'],'得分:',ikun['score'],'技能:',ikun['skill'])
# 格式化字符串（字符串中间加入变量）
print(f"姓名:{ikun[f'name']}得分:{ikun['score']}技能:{ikun['skill']}")

# 刷新输出流
# print('正在取款中...', end=' ', flush=True)
# time.sleep(2)
# print('取款成功')

# 输出原始文本
print("C:\\Users\\Name\\Documents")
print(r"C:\Users\Name\Documents")

# 列表常用操作方法
stars1 = ['张三丰', 'ikun', 'TFbodys', 'Kobe']
# 插入数据
stars1.insert(1, 'Iverson')
print(stars1)
try:
    print('找到的数据序号是：',stars1.index('Iverson1'))
except ValueError:
    print('没找到该数据')

# 字典操作常用方法
# 读取、新增字段、删除字段、判断是否存在、字典合并
ikun1 = {'name': '坤坤', 'score': 100, 'skill': '唱跳rap篮球'}
ikun1['city'] = '成都'
print(ikun1)
ikun1.pop('skill')
print(ikun1)
print('skill' in ikun1)
print('skill' not in ikun1)
ikun2 = {'project':'鬼畜视频'}
# 字典合并
ikun1.update(ikun2)
print(ikun1)
